<template>
  <div class="home-page">
    <div class="managerText">您好，管理员！欢迎使用本系统</div>
    <div class="header">本期宠物颜值排行榜：</div>
    <div class="container">
      <div v-for="(item, index) in notices" :key="index" class="notice">
        <img :src="item.image" alt="your-image-description" class="image">
        <h2 class="title">{{ item.title }}</h2>
        <p class="text">{{ item.text }}</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'HomePage',
  data () {
    return {
      notices: [
        { title: '张小马(猫猫)', text: '认识一下我：我是一只小喵咪，我很可爱哦！', image: require('@/assets/images/1.jpg') },
        { title: '张小羊(猫猫)', text: '认识一下我：我是一只小喵咪，我很可爱哦！', image: require('@/assets/images/2.jpg') },
        { title: '张小猪(猫猫)', text: '认识一下我：我是一只小喵咪，我很可爱哦！', image: require('@/assets/images/3.jpg') },
        { title: '张小龙(狗狗)', text: '认识一下我：我是一只小狗狗，我很乖的哦！', image: require('@/assets/images/4.jpg') },
        { title: '张小虎(狗狗)', text: '认识一下我：我是一只小狗狗，我很乖的哦！', image: require('@/assets/images/5.jpg') },
        { title: '张小猴(狗狗)', text: '认识一下我：我是一只小狗狗，我很乖的哦！', image: require('@/assets/images/6.jpg') }
      ]
    }
  }
}
</script>

<style scoped>
.clearfix::after {
  content: "";
  display: table;
  clear: both;
}

.home-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh; /* 使容器至少与视口高度相同 */
}

.managerText {
  width: 100%;
  text-align: center;
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  font-size: 1.25rem;
  color: #000000;
  background-color: #ffffff;
}

.header {
  width: 100%;
  text-align: left;
  padding: 1rem;
  font-size: 1.5rem;
  color: #82836e;
}

.container {
  display: flex;
  flex-wrap: wrap; /* 允许元素换行 */
  justify-content: space-between; /* 均匀分配剩余空间 */
  width: 100%;
}

.notice {
  width: calc(30% - 2rem); /* 占据33.333%的宽度，并减去左右边距 */
  height: auto;
  margin: 1rem;
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background-color: white;
  font-size: 1.2rem;
  color: #333;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.3s ease;

  &:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  }
}

.image {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
}

.title {
  margin-top: 1rem;
  text-align: center;
}

.text {
  margin-top: 1rem;
  text-align: justify;
}
</style>